home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib9
/
v_11_02
/
1102073a
< prev
next >
Wrap
Text File
|
1995-11-01
|
2KB
|
48 lines
/**************************************************
*
* manual_threshold_segmentation(...
*
* This function segments an image using thresholding
* given the hi and low values of the threshold
* by the calling routine. It reads in an image
* and writes the result to the output image.
*
* If the segment parameter is 0, you only
* threshold the array - you do not segment.
*
***************************************************/
manual_threshold_segmentation(in_name, out_name,
the_image, out_image,
il, ie, ll, le,
hi, low, value, segment)
char in_name[], out_name[];
int il, ie, ll, le, segment;
short hi, low, the_image[ROWS][COLS],
out_image[ROWS][COLS], value;
{
int length, width;
struct tiff_header_struct image_header;
if(does_not_exist(out_name)){
printf("\n\nMTS> output file does not exist %s",
out_name);
read_tiff_header(in_name, &image_header);
round_off_image_size(&image_header,
&length, &width);
image_header.image_length = length*ROWS;
image_header.image_width = width*COLS;
create_allocate_tiff_file(out_name, &image_header,
out_image);
} /* ends if does_not_exist */
read_tiff_image(in_name, the_image, il, ie, ll, le);
threshold_image_array(the_image, out_image,
hi, low, value);
if(segment == 1)
grow(out_image, value);
write_array_into_tiff_image(out_name, out_image,
il, ie, ll, le);
} /* ends manual_threshold_segmentation */